<script>
 window.onload = function(){
        fn();
                document.getElementById('sp').innerHTML = '<<'
        
    }
		function fn(){
			var q = document.getElementById('sp')
			console.log(q.innerHTML)
			if(q.innerHTML.trim() == '&lt;&lt;'){
			document.getElementById('sidebar-wrapper').setAttribute('style','display:none')
			document.getElementsByTagName('body')[0].setAttribute('style','')
			document.getElementById('sp').innerHTML = '>>'
			}else{
			fn2()
			}
			
		}
		function fn2(){
			document.getElementById('sidebar-wrapper').setAttribute('style','display:inline')
			document.getElementsByTagName('body')[0].setAttribute('style','margin-left:200')
			document.getElementById('sp').innerHTML = '<<'
		
		}
	</script>
<nav class="navbar navbar-default" role="navigation">

	<div class="navbar-header">
		<button type="button" class="navbar-toggle" data-toggle="collapse"
			data-target="#bs-example-navbar-collapse-1">
			<span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span
				class="icon-bar"></span><span class="icon-bar"></span>
		</button>
		<a class="navbar-brand" href="#" onClick="fn()" > <span id="sp"> << </span> IOTLAB</a>
		
	</div>

	<div  class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		<a class="navbar-brand" href="#"><#if Session.user ??>hello
			${Session.user.nickname}
			<#if Session.user.point gte 0 && Session.user.point lte 200 > <img
			style="width: 18px; padding-bottom:4px"
			src="static/image/v_1.png" /></#if>
			<#if Session.user.point gt 201 && Session.user.point lte 300 > <img
			style="width: 18px; padding-bottom:4px"
			src="static/image/v_2.png" /></#if>
			<#if Session.user.point gt 301 && Session.user.point lte 400 > <img
			style="width: 18px; padding-bottom:4px"
			src="static/image/v_3.png" /></#if>
			<#if Session.user.point gt 401> <img
			style="width: 18px; padding-bottom:4px"
			src="static/image/v_4.png" /></#if>
			</#if></a>
		<form  class="navbar-form navbar-left" action="news?method=search" method="post" >
<div class="input-group">
     	<input id="searchvalue" type="text" name="key" class="form-control" placeholder="找点乐子..." />
      <span class="input-group-btn">
       <#if Session.user ??> 
        <button id="search" class="btn btn-default"   type="submit"  > <span class="glyphicon glyphicon-search" /></button>
      <#else>
      	<a id="search" class="btn btn-default "  ><span class="glyphicon glyphicon-search" /></a>
      </#if>  
      
      </span>
    </div>
			<#if Session.user ?? > <#else>
			 	 <a data-toggle="modal" class="btn btn-default btn-md" data-target="#register" href=""><span class="glyphicon glyphicon-user"></span> 快速注册</a>
			 </#if>
			 <a class="btn btn-default" href="index">  <span class="glyphicon glyphicon-home" /> </a>
		</form>
		<ul class="nav navbar-nav navbar-right">
		<#if Session.user ??> 
			<li><a href="news?method=add_page">发布比赛</a></li>
			</#if>
			<li class="dropdown"><#if Session.user ??> <a href="#"
				class="dropdown-toggle" data-toggle="dropdown">${Session.user.nickname}<strong
					class="caret"> <#else><a data-toggle="modal" data-target="#login" href=""><span class="glyphicon glyphicon-log-in"></span> 请登录</#if></strong>
			</a> <#if Session.user ??>
				<ul class="dropdown-menu">
					<li><a href="user?method=detail_page">我的等级？</a></li>
					<li><a href="user?method=detail_page&key=edit">修改密码</a></li>
					<li class="divider"></li>
					<li><a href="javascript:tip('请求已发送，等待审核')">申请成为管理员</a></li>
					<li class="divider"></li>
					<li><a href="login?method=logout">切换账号</a></li>
					<li><a href="login?method=logout">注销</a></li>
				</ul> </#if>
			</li>
		</ul>
	</div>

</nav>